package com.gs.disk.modules.headImgAndWallper.dao.admin;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gs.common.mapper.CommonMapper;
import com.gs.disk.modules.headImgAndWallper.entity.CategoryEntity;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface AdminCategoryDao extends CommonMapper<CategoryEntity, CategoryEntity> {

    /**
     * 根据分类名获取分类
     * @param categoryName
     * @return
     */
    default CategoryEntity getByName(String categoryName) {
        QueryWrapper<CategoryEntity> wrapper = new QueryWrapper<>();
        wrapper.select("id, category_name");
        wrapper.eq("category_name", categoryName);

        return this.selectOne(wrapper);
    }
}
